const Koa = require('koa');
const path = require('path');
const static = require('koa-static');

const app = new Koa();

// 静态资源目录对于相对入口文件index.js的路径
const staticPath = './static';

app.use(static(
    path.join(__dirname, staticPath)
));

app.use(async (ctx) => {
    ctx.body = 'Hello koa!';
});

app.listen(8686, () => {
    console.log(`服务启动成功：http://localhost:8686`);
});